package Controllers;

import java.rmi.RemoteException;


import ControllerStarter.BishopControllerStarter;
import ControllerStarter.BoardControllerStarter;
import ControllerStarter.GameControllerStarter;
import ControllerStarter.KingControllerStarter;
import ControllerStarter.KnightControllerStarter;
import ControllerStarter.PawnControllerStarter;
import ControllerStarter.QueenControllerStarter;
import ControllerStarter.RookControllerStarter;
import Controllers.ControllerCreaterInterfece;

public class ControllerCreater implements ControllerCreaterInterfece {

	private int index;
	private PawnControllerStarter pawnControllerStarter;
	private BoardControllerStarter boardControllerStarter;
	private KnightControllerStarter knightControllerStarter;
	private RookControllerStarter rookControllerStarter;
	private QueenControllerStarter queenControllerStarter;
	private KingControllerStarter kingControllerStarter;
	private BishopControllerStarter bishopControllerStarter;
	private GameControllerStarter gameControllerStarter;

	public ControllerCreater(PawnControllerStarter pawnControllerStarter,
			BoardControllerStarter boardControllerStarter,
			KnightControllerStarter knightControllerStarter,
			RookControllerStarter rookControllerStarter,
			QueenControllerStarter queenControllerStarter,
			KingControllerStarter kingControllerStarter,
			BishopControllerStarter bishopControllerStarter,
			GameControllerStarter gameControllerStarter) {
		this.pawnControllerStarter = pawnControllerStarter;
		this.boardControllerStarter = boardControllerStarter;
		this.knightControllerStarter = knightControllerStarter;
		this.rookControllerStarter = rookControllerStarter;
		this.queenControllerStarter = queenControllerStarter;
		this.kingControllerStarter = kingControllerStarter;
		this.bishopControllerStarter = bishopControllerStarter;
		this.gameControllerStarter = gameControllerStarter;
		index = 1;
	}

	@Override
	public String createBoard() throws RemoteException {
		return boardControllerStarter.createBoard(index++);
	}

	@Override
	public String createPawn() throws RemoteException {
		return pawnControllerStarter.createChessPiece(index++);
	}

	@Override
	public String createKnight() throws RemoteException {
		return knightControllerStarter.createChessPiece(index++);
	}

	@Override
	public String createRook() throws RemoteException {
		return rookControllerStarter.createChessPiece(index++);
	}

	@Override
	public String createQueen() throws RemoteException {
		return queenControllerStarter.createChessPiece(index++);
	}

	@Override
	public String createKing() throws RemoteException {
		return kingControllerStarter.createChessPiece(index++);
	}

	@Override
	public String createBishop() throws RemoteException {
		return bishopControllerStarter.createChessPiece(index++);
	}

	@Override
	public String createGame() throws RemoteException {
		return gameControllerStarter.createGame(0);
	}

}
